package day1104.demo01;

import java.util.function.BiPredicate;
import java.util.function.Predicate;

/**
 * @program: qy158
 * @description:
 * @author: 闫克起2
 * @create: 2022-11-04 09:10
 **/
public class TestPredicate {
    public static void main(String[] args) {
        //根据你传递的字符串，判断字符串的长度是否大于5.
        //boolean test(T t); 方法体中有且仅有一条语句，返回结果。 则可以省略{}以及return关键字
        Predicate<String> predicate=t->t.length()>5;
        fun(predicate,"hello");


        //boolean test(T t, U u);
        BiPredicate<String, String> biPredicate=(t,u)->t.equals(u);
        boolean test = biPredicate.test("hello", "world");
        System.out.println(test);

    }

    public static void fun(Predicate<String> predicate,String s ){
        boolean test = predicate.test(s);
        System.out.println(test);
    }


}
